<?php

include '../../init.php';

if (!$_SESSION['is_login'] || empty($_SESSION['uid'])) {
	show_msg(1, '请先登录', $time = 3, $url = '../../index.php');
	exit();
}

// 查询个人信息,因为不对个人开放,不需要传入ID
$uid = @$_SESSION['uid'];
$sql = "SELECT alias, truename, avatarid, gender, unix_timestamp(birthyear) as birthyear, phone, qid, answer,address FROM `userinfo_tb` WHERE uid=".$uid.' LIMIT 1;';
$arr = array();
if (!my_mysql_query($sql, $arr)){
	show_msg(1, '获取个人信息失败', 3, '../../index.php');
	exit();
}
setSessionForKey($arr[0]);
?>
<!DOCTYPE html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>个人信息</title>
	<meta name="keywords" content="">

	<link rel="stylesheet" type="text/css" href="./css/style_3_common.css">
	<link rel="stylesheet" type="text/css" href="./css/style_3_home_space.css">
	<link rel="stylesheet" id="css_widthauto" type="text/css" href="./css/style_3_widthauto.css">
	<link rel="stylesheet" type="text/css" id="gfan_css" href="./css/gfan_bbs.css">

	<style type="text/css">
	.ct2_a .appl {
		margin-left: -150px;
	}
	.appl {
		float: left;
		overflow: hidden;
		margin-bottom: 10px;
		padding: 6px 10px;
		width: 117px;
	}
    .main-div{
        margin:25px auto;
        width:960px;
        background-color:#F7F7F7;
    }
    body{
        background-color:#F9F9F9;
    }
	</style>
</head>

<body id="nv_home" class="pg_space">
	<div id="wp" class="main-div">
		<div id="pt" class="bm cl">
			<div class="z">
				<a href="../../index.php" title="首页">首页</a> <em>›</em>个人资料
			</div>
		</div>
		<div id="ct" class="ct2_a cl">
			<div class="mn">
				<div class="bm bw0">
					<h1 class="mt">修改个人头像</h1>
					<!--don't close the div here-->
					<form action="update.php" method="post" autocomplete="off" enctype="multipart/form-data">
						<input type="hidden" name="method" value="update_avatar_info">
						<table summary="个人资料" cellspacing="0" cellpadding="0" class="tfm">
							<tbody>
								<tr>
									<td>
										<h3>当前使用头像:</h3>
										<img src="../../common/make_avatar.php?uid=<?php echo $uid; ?>" width="350" height="350" />
									</td>
									<td style="padding-left:30px;">
										<h3>新的头像:</h3>
										<br />
										<input type="file" name="avatar">
									</td>
								</tr>
								<tr>
									<th>&nbsp;</th>
									<td>
										<button type="submit" name="pwdsubmit" value="true" class="pn pnc"><strong>保存</strong></button>
									</td>
								</tr>
							</tbody>
						</table>
					</form>
				</div>

			</div>
			<div class="appl">
				<div class="tbn">
					<h2 class="mt bbda">设置</h2>
					<ul>
					<ul>
						<li><a href="index.php?uid=<?php echo $uid;?>">个人资料</a></li>
						<li class="a"><a href="#">修改头像</a></li>
						<li><a href="safe.php">密码安全</a></li>
						<li><a href="score.php">积分</a></li>
					</ul>
				</div>
			</div>
		</div>
	</body>
	</html>
